package com.caldremch.androidfoundation.base;


import android.os.Bundle;

import com.trello.rxlifecycle3.components.support.RxAppCompatActivity;

import androidx.annotation.Nullable;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * @author Caldremch
 * @date 2018/11/3
 * @Email caldremch@163.com
 * @describe Activity基类
 *
 **/
public abstract class BaseActivity extends RxAppCompatActivity {

    // TODO: 2018/11/3 网络状态, 错误状态页等封装

    private Unbinder mUnbinder;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        mUnbinder = ButterKnife.bind(this);
        initView();
        initData();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        mUnbinder.unbind();
    }

    protected abstract int getLayoutId();

    protected abstract void initView();

    protected abstract void initData();
}
